<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkForm() {
		var type = document.getElementById("type").value;
		var Address = document.getElementById("address").value;
		var info = document.getElementById("info").value;
		var logo = document.getElementById("logo").value;
		var email = document.getElementById("email").value;
		if (type == null || type == "") {
			document.getElementById("typeerror").innerHTML = "类型不能为空！";
			return false;
		}
		if (Address == null || Address == "") {
			document.getElementById("addresserror").innerHTML = "地址不能为空！";
			return false;
		}
		if (email == null || email == "") {
			document.getElementById("emailerror").innerHTML = "邮件不能为空！";
			return false;
		}
		if (info == null || info == "") {
			document.getElementById("infoerror").innerHTML = "个人详情不能为空！";
			return false;
		}
		if (logo == null || logo == "") {
			document.getElementById("logoerror").innerHTML = "图片不能为空！";
			return false;
		} 
		return true;
	}
</script>
</head>
<body>
	<form role="form" action="${pageContext.request.contextPath }/merchant?action=editInfo" method="post" onsubmit="return checkForm()"  enctype="multipart/form-data" class="login-form">
		<h3>Person Info</h3>
		<input type="hidden" name="mid" class="form-username form-control"
			id="form-username" value="${merchant.mid }">
			
		<input type="hidden" name="password" class="form-username form-control"
			id="form-username" value="${merchant.password }">
			
		<div class="form-group">
			<label>Username</label> <input type="text" 
				class="form-username form-control" id="username" name="mname"
				value="${merchant.mname }"><span id="usererror" color="red"></span>
		</div>

		<div class="form-group">
			<label>Tel</label> <input type="tel" class="form-control disabled"
				name="tel" id="tel" value="${merchant.tel }"><span id="telerror" color="red"></span>
		</div>

		<div class="form-group">
			<label>Type</label> <input type="text" class="form-control"
				name="type" id="type" value=${merchant.type }><span id="typeerror" color="red"></span>
		</div>

		<div class="form-group">
			<label>Email</label> <input type="email" class="form-control"
				name="email" id="email" value=${merchant.email }><span id="emailerror" color="red"></span>
		</div>
		
		<div class="form-group">
			<label>Address</label> <input type="text" class="form-control"
				name="address" id="address" value=${merchant.address}><span id="addresserror" color="red"></span>
		</div>

		<div class="form-group">
			<label>Info</label>
			<textarea class="form-control" name="info" rows="3" id="info"
				value=${merchant.info}></textarea><span id="infoerror" color="red"></span>
		</div>

		<div class="form-group">
			<label>Logo File</label> <input type="file" id="logo" name="logo">
			<p class="help-block">Please upload your img.</p><span id="logoerror" color="red"></span>
		</div>
		<button type="submit" class="btn btn-primary login-btn">Submit</button>
	</form>
	</div>
</body>
</html>